package org.soar;

import java.util.ArrayList;
import java.util.List;

import android.app.Application;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;

public abstract class SoarApplication extends Application{

	protected Injector injector = null;
	protected List<Module> modules = new ArrayList();
	@Override
	public void onCreate() {
		super.onCreate();
		//init custom module;
		modules.add(new SoarModule());
		onInjectModules();
		injector = Guice.createInjector(modules);
		SoarContainer container = injector.getInstance(SoarContainer.class);
		container.processApplicationContext(this);
	}
	
	public Injector getInjector() {
		return injector;
	}
	
	public SoarContainer getSoarContainer() {
		return injector.getInstance(SoarContainer.class);
	}
	
	protected abstract void onInjectModules();
	
}
